#include "CharTexture.h"
#include "Font/TextPoolMacros.h"
#include "Texture/Texture2D.h"

int32_t SCharTexture::GetDataOffset(int32_t InLineOfChar) const
{
    return TEXTURE_IN_POOL_SIZE *(Y +InLineOfChar) + X;
}

SRenderCharTexture SCharTexture::ToRenderTexture() const
{
    SRenderCharTexture Result;
    Result.Texture=Texture->GetRenderTexture();
    Result.LeftTopUV.X=(float)X/(float)Texture->GetWidth();
    Result.LeftTopUV.Y=(float)Y/(float)Texture->GetHeight();
    Result.RightBottomUV.X=(float)(X+RawWidth)/(float)Texture->GetWidth();
    Result.RightBottomUV.Y=(float)(Y+RawHeight)/(float)Texture->GetHeight();
    Result.Size.X=Width;
    Result.Size.Y=Height;
    return Result;
}
